<?php
namespace Home\Model;
use Think\Model;
class ThingModel extends Model{
	public function successRecord($i){
		$record = M('thing');//暂时先用thing代替，等填好trade_record的数据再使用M('trade_record')
    	$data = $record -> where('status=1') -> limit($i)->select();
    	return $data;
	}
	public function getFoundRecord($i,$where){
		$record = M('thing');
      //  $where['lost_or_pick']=1;
		$data = $record ->where($where) -> limit($i) -> select();//还要加上trade_record里的is_success才能判断
		return $data;
	}
	public function getLostThingRecord(){
		// $con=mysqli_connect("localhost","root","1234","lost-found");
		// $sql ="SELECT * FROM lost_thing,lost_trade_record where lost_thing.id = lost_trade_record.thing_id AND lost_trade_record.is_success=1" 
		// $data = mysql_query($con,$sql);
		// return $data;
		// $lost_thing = M('thing');
		// $lost_trade_record = M('trade_record');
		// $data1 -> table('lost-found.lost_thing') -> where('lost_or_pick=1') -> select();
		// return $data1;
		// $lost_thing = M('thing');
		// $data = $lost_thing -> where('lost_or_pick=1') -> limit(15) -> select();
		// return $data;
		$things = M('thing')->where("status = 0 AND lost_or_pick = 0")->select();
		return $things;
	}
    public  function getPicture()
    {
        $picture=M('thing')->field('pic1')->limit(10)->select();
        return $picture;
    }


}